package com.atguigu.client;

import com.atguigu.entity.CartInfo;
import com.atguigu.result.RetVal;
import com.atguigu.search.SearchParam;
import com.atguigu.util.AuthContextHolder;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Repository;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Repository
@FeignClient(value = "shop-cart")
public interface CartFeignClient {
    @GetMapping("/cart/addToCart/{skuId}/{skuNum}")
    public RetVal addToCart(@RequestParam Long skuId, @RequestParam Long skuNum);
    //购物车列表
    @GetMapping("/cart/getCartList")
    public RetVal getCartList();

    //http://api.gmall.com/cart/checkCart/24/0
    //3.商品的选中
    @GetMapping("/cart/checkCart/{skuId}/{isChecked}")
    public RetVal checkCart(@PathVariable Long skuId, @PathVariable Integer isChecked);
    //4.商品购物车删除 deleteCart/24
    @DeleteMapping("/cart/deleteCart/{skuId}")
    public RetVal deleteCart(@PathVariable Long skuId);
    //5.查询选中的商品信息
    @GetMapping("/cart/getSelectedProduct/{userId}")
    public List<CartInfo> getSelectedProduct(@PathVariable String userId);

    //6.从数据库中查询购物车缓存信息
    @GetMapping("/cart/queryFromDbToRedis/{userId}")
    public List<CartInfo> queryFromDbToRedis(@PathVariable String userId);
}

